<?php

namespace App\Http\Requests\Backend;

use Illuminate\Foundation\Http\FormRequest;

class CategoryRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $rules = [
            'name' => ['bail','required','max:50'],
            'description' => ['bail', 'required'],
            'pid'=>['bail','required']
        ];



        return $rules;
    }

    public function messages()
    {
        return [
            'name.required' => '请输入分类名称',
            'name.max' => '分类长度不能超过50个字符',
            'description.required' => '请输入描述',
            'pid.required' => '分类不能为空',
        ];
    }
}
